package springBoot_dzfpxt.custom;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import springBoot_dzfpxt.entity.EimUser;
import springBoot_dzfpxt.entity.QiyecaozuoTable;
import springBoot_dzfpxt.service.QiyecaozuoTableService;
@Component
public class CaozuoUtils {

	@Autowired
	private UserUtils userUtils;
	@Autowired
	private QiyecaozuoTableService caozuoService;
	
	public void savecaozuo(String caozuo) {
		EimUser user = userUtils.getUser();
		QiyecaozuoTable table = new QiyecaozuoTable();
		table.setCaozuo(caozuo);
		Date date = new java.util.Date();
		java.sql.Date date2 = new java.sql.Date(date.getTime());
		table.setCaozuoDate(date2);
		table.setUsername(user.getUsername());
		table.setName(user.getName());
		caozuoService.save(table);
	}
}
